<?php
class comment_model extends CI_Model 
{
    function __construct()
    {
        parent::__construct();
    }
	
	function get_approved_product_comments($product_id=0, $order_by)
	{
		$query = "SELECT * FROM product_comments WHERE product_id=${product_id} and comment_status=0 " . (empty($order_by) ? "" : "order by ${order_by}");
		return $this->db->query($query);
	}
	
	function add_product_comments($data)
	{
        foreach ($data as $key => $value)
        {
            $data[$key] = htmlentities($value);
        }
		
        return $this->db->insert('product_comments', $data);
	}
}

/* End of file comment_model */
/* Location: ./application/model/comment_model.php */